package lrg10002.exostention.element;

import cpw.mods.fml.common.registry.LanguageRegistry;
import lrg10002.exostention.core.StatCommand;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ItemElement extends Item{
	
	public ItemElement(int id) {
		super(id);
		setHasSubtypes(true);
		setMaxDamage(ElementType.ELEMENT_TYPES.length);
	}
	
	@Override
	public String getTextureFile() {
		return StatCommand.ELEMENT_TEXTURE_FILE;
	}
	
	
	@Override
	public int getIconFromDamage(int i) {
		return i;
	}
	
	public void initNames() {
		for (int x = 0; x < this.getMaxDamage(); x++) {
			ItemStack is = new ItemStack(this, 1, x);
			LanguageRegistry.addName(is, ElementType.ELEMENT_TYPES[x].getName());
		}
	}
	
	
	@Override
	public String getItemNameIS(ItemStack is) {
		return new StringBuilder().append(this.getItemName()).append(".").append(ElementType.ELEMENT_TYPES[is.getItemDamage()].getBackName()).toString();
	}

}
